package cn.cimoc.mapper;

import cn.cimoc.pojo.Result;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author LGZ
 * @date 2022/7/6 16:46
 * <p>
 */
@Repository
public interface ResultMapper {

    @Insert("INSERT INTO result VALUES (#{res.id}, #{res.studentno}, #{res.subjectid}, #{res.score}, #{res.examdate})")
    void insertResult(@Param("res") Result res);

    @Delete("DELETE FROM result WHERE id = #{id}")
    void deleteById(@Param("id")long id);

    @Select("SELECT * FROM result WHERE id = #{id}")
    Result selectById(@Param("id")long id);

    @Select("SELECT * FROM result")
    Result[] selectAll();

}
